<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

include_once 'class.phpmailer.php';

function sendMailPadrao($para,$assunto,$mensagem){

    $mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch

    try {
        //    $mail->SetLanguage('br');
        //  $mail->Host       = "mail.yourdomain.com"; // SMTP server
          $mail->AddAddress($para);
          $mail->SetFrom('no-reply@vantilcargas.com.br', 'Vantil Cargas');
        //  $mail->AddReplyTo('name@yourdomain.com', 'First Last');
          $mail->Subject = $assunto;
        //  $mail->ContentType = "text/html; charset=iso-8859-1";
          $mail->AltBody = 'Para ver essa mensagem, use um leitor compativel com HTML'; // optional - MsgHTML will create an alternate automatically
          $mail->MsgHTML('<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head>'.
              '<body style="text-align:center; font-size: 20px"><img src="'.$url_site.'imagens/logo_flash.png"></img><br/>'.$mensagem.'</body></html>');
        //  $mail->AddAttachment('images/phpmailer.gif');      // attachment
        //  $mail->AddAttachment('imagens/logo_flash.png', 'logo_flash.png'); // attachment
          $mail->Send();
        } catch (phpmailerException $e) {
          echo $e->errorMessage(); //Pretty error messages from PHPMailer
        //        throw $e;
        } catch (Exception $e) {
          echo $e->getMessage(); //Boring error messages from anything else!
        //    throw $e;
    }
}

function sendMail($para,$assunto,$mensagem){

    $mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch

    try {
        //    $mail->SetLanguage('br');
        //  $mail->Host       = "mail.yourdomain.com"; // SMTP server
        if(is_array($para)){
            foreach ($para as $email) {
                $mail->AddAddress($email);
            }
        }else{
            $mail->AddAddress($para);
        }
          
          $mail->SetFrom('no-reply@vantilcargas.com.br', 'Vantil Cargas');
        //  $mail->AddReplyTo('name@yourdomain.com', 'First Last');
          $mail->Subject = $assunto;
        //  $mail->ContentType = "text/html; charset=iso-8859-1";
          $mail->AltBody = 'Para ver essa mensagem, use um leitor compativel com HTML'; // optional - MsgHTML will create an alternate automatically
          $mail->MsgHTML('<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head>'.
              '<body font-size: 20px">'.$mensagem.'</body></html>');
        //  $mail->AddAttachment('images/phpmailer.gif');      // attachment
        //  $mail->AddAttachment('imagens/logo_flash.png', 'logo_flash.png'); // attachment
          $mail->Send();
        } catch (phpmailerException $e) {
          echo $e->errorMessage(); //Pretty error messages from PHPMailer
        //        throw $e;
        } catch (Exception $e) {
          echo $e->getMessage(); //Boring error messages from anything else!
        //    throw $e;
    }
}
?>
